<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title th:text="${user.username} + ' - 用户详情'">用户详情</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Microsoft YaHei', Arial, sans-serif;
            background-color: #f5f5f5;
            color: #333;
        }

        .container {
            max-width: 800px;
            margin: 0 auto;
            padding: 20px;
        }

        .back-nav {
            margin-bottom: 20px;
        }

        .back-btn {
            display: inline-block;
            padding: 8px 16px;
            background: #ecf0f1;
            color: #2c3e50;
            text-decoration: none;
            border-radius: 5px;
            transition: background 0.3s;
        }

        .back-btn:hover {
            background: #d5dbdb;
        }

        .user-profile {
            background: white;
            padding: 40px;
            border-radius: 10px;
            box-shadow: 0 2px 10px rgba(0,0,0,0.1);
            margin-bottom: 20px;
        }

        .user-header {
            display: flex;
            align-items: center;
            gap: 30px;
            margin-bottom: 30px;
            padding-bottom: 20px;
            border-bottom: 1px solid #eee;
        }

        .user-avatar {
            width: 100px;
            height: 100px;
            border-radius: 50%;
            background: linear-gradient(135deg, #3498db, #2c3e50);
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            font-size: 36px;
            font-weight: bold;
        }

        .user-info h1 {
            font-size: 28px;
            color: #2c3e50;
            margin-bottom: 10px;
        }

        .user-email {
            color: #666;
            margin-bottom: 10px;
        }

        .user-status {
            display: inline-block;
            padding: 4px 12px;
            border-radius: 15px;
            font-size: 12px;
            font-weight: bold;
        }

        .status-active {
            background: #e8f5e8;
            color: #27ae60;
        }

        .status-inactive {
            background: #fdf2f2;
            color: #e74c3c;
        }

        .user-bio {
            background: #f8f9fa;
            padding: 20px;
            border-radius: 8px;
            margin-bottom: 30px;
            color: #555;
            font-style: italic;
        }

        .user-stats {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
            gap: 20px;
            margin-bottom: 30px;
        }

        .stat-card {
            background: #f8f9fa;
            padding: 20px;
            border-radius: 8px;
            text-align: center;
            transition: transform 0.2s;
        }

        .stat-card:hover {
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(0,0,0,0.1);
        }

        .stat-number {
            font-size: 24px;
            font-weight: bold;
            color: #3498db;
            margin-bottom: 5px;
        }

        .stat-label {
            color: #666;
            font-size: 14px;
        }

        .user-timeline {
            margin-top: 20px;
        }

        .timeline-item {
            display: flex;
            gap: 15px;
            color: #666;
            font-size: 14px;
        }

        .timeline-item:not(:last-child) {
            margin-bottom: 10px;
        }

        .timeline-label {
            width: 80px;
            font-weight: bold;
        }

        .action-buttons {
            text-align: center;
            margin-top: 30px;
        }

        .action-btn {
            padding: 12px 24px;
            margin: 0 10px;
            border: none;
            border-radius: 5px;
            cursor: pointer;
            font-size: 14px;
            transition: background 0.3s;
        }

        .follow-btn {
            background: #3498db;
            color: white;
        }

        .follow-btn:hover {
            background: #2980b9;
        }

        .message-btn {
            background: #95a5a6;
            color: white;
        }

        .message-btn:hover {
            background: #7f8c8d;
        }
    </style>
</head>
<body>
<div class="container">
    <div class="back-nav">
        <a href="javascript:history.back()" class="back-btn">← 返回搜索</a>
    </div>

    <div class="user-profile">
        <div class="user-header">
            <div class="user-avatar" th:text="${#strings.substring(user.username, 0, 1).toUpperCase()}">
                U
            </div>
            <div class="user-info">
                <h1 th:text="${user.username}">用户名</h1>
                <div class="user-email" th:text="${user.email}">邮箱</div>
                <span class="user-status"
                      th:class="${user.status == 1} ? 'user-status status-active' : 'user-status status-inactive'"
                      th:text="${user.status == 1} ? '正常' : '已禁用'">
                        状态
                    </span>
            </div>
        </div>

        <div class="user-bio" th:if="${user.bio != null and user.bio != ''}" th:text="${user.bio}">
            个人简介
        </div>
        <div class="user-bio" th:if="${user.bio == null or user.bio == ''}" style="color: #999; text-align: center;">
            该用户还没有填写个人简介
        </div>

        <div class="user-stats">
            <div class="stat-card">
                <div class="stat-number" th:text="${user.followerCount} ?: 0">0</div>
                <div class="stat-label">粉丝</div>
            </div>
            <div class="stat-card">
                <div class="stat-number" th:text="${user.followingCount} ?: 0">0</div>
                <div class="stat-label">关注</div>
            </div>
            <div class="stat-card">
                <div class="stat-number" th:text="${user.articleCount} ?: 0">0</div>
                <div class="stat-label">文章</div>
            </div>
        </div>

        <div class="user-timeline">
            <div class="timeline-item">
                <span class="timeline-label">注册时间:</span>
                <span th:text="${#temporals.format(user.createTime, 'yyyy-MM-dd HH:mm')}">注册时间</span>
            </div>
            <div class="timeline-item" th:if="${user.lastLoginTime != null}">
                <span class="timeline-label">最后登录:</span>
                <span th:text="${#temporals.format(user.lastLoginTime, 'yyyy-MM-dd HH:mm')}">最后登录时间</span>
            </div>
            <div class="timeline-item" th:if="${user.lastLoginTime == null}">
                <span class="timeline-label">最后登录:</span>
                <span style="color: #999;">从未登录</span>
            </div>
        </div>

        <div class="action-buttons">
            <button class="action-btn follow-btn" onclick="followUser()">关注</button>
            <button class="action-btn message-btn" onclick="sendMessage()">发消息</button>
        </div>
    </div>
</div>

<script>
    function followUser() {
        // 这里可以添加关注逻辑
        alert('关注功能待实现');
    }

    function sendMessage() {
        // 这里可以添加发消息逻辑
        alert('发消息功能待实现');
    }
</script>
</body>
</html>